function [fn,fp] = ak_countMatchResults(res,dim,window)

fn = 0;
fp = 0;
M = reshape(res,dim,dim)';

for i = 1:dim
    for j = 1:dim
        if M(i,j) < window
            if i ~= j
                fp = fp + 1;
            end
        else
            if i == j
                fn = fn + 1;
            end
        end
    end
end

fn
fp